package cn.leida.ruoyi.system.domain;

import cn.leida.ruoyi.common.annotation.Excel;
import cn.leida.ruoyi.common.annotation.Excel.ColumnType;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.leida.ruoyi.common.core.domain.BaseEntity;

/**
 * 参数配置表 sys_config
 *
 * @author liutietou
 * @since 1.0  2020-12-11
 */
@Entity
@Table(name = "sys_config")
@Data
public class SysConfig extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 参数主键
     */
    @Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "config_id")
    private Long configId;

    /**
     * 参数名称
     */
    @Excel(name = "参数名称")
    @NotBlank(message = "参数名称不能为空")
    @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
    @Column(name = "config_name", length = 100)
    private String configName;

    /**
     * 参数键名
     */
    @Excel(name = "参数键名")
    @NotBlank(message = "参数键名长度不能为空")
    @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
    @Column(name = "config_key", length = 100)
    private String configKey;

    /**
     * 参数键值
     */
    @Excel(name = "参数键值")
    @NotBlank(message = "参数键值不能为空")
    @Size(min = 0, max = 1000, message = "参数键值长度不能超过500个字符")
    @Column(name = "config_value", length = 1000)
    private String configValue;

    /**
     * 系统内置（Y是 N否）
     */
    @Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
    @Column(name = "config_type", length = 10)
    private String configType;

    /**
     * 创建者
     */
    @Column(name = "create_by", length = 64)
    private String createBy;

    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 30)
    private String createTime;

    /**
     * 更新者
     */
    @Column(name = "update_by", length = 64)
    private String updateBy;

    /**
     * 更新时间
     */
    @Column(name = "update_time", length = 30)
    private String updateTime;

    /**
     * 备注
     */
    @Column(name = "remark", length = 500)
    private String remark;

    public void initUpdateTime() {
        updateTime = nowTime();
    }

    public void initCreateTime() {
        createTime = nowTime();
    }


}
